<div class="bjui-pageContent">
    <form action="{:U('AfterSales/addRecord')}" class="pageForm" data-toggle="validate" method="post">
	<table width="100%" border="0" cellspacing="0" cellpadding="10">
	  <tbody>
		<tr>
		  <td bgcolor="#FFFFFF" style="padding: 10px;"><!-- 内容开始 -->
			<div id="SaleAfterInfo" style="display:;"> <b>出库单信息：</b>
			  <table width="100%" border="0" cellspacing="0" cellpadding="5" class="Main_List_Table" rules="none" style="border: 1px solid #ddd;margin-top: 10px;">
				<tbody>
				  <tr class="Main_List_Table_Tr1">
					<td width="15%"><div align="center"> 出库单号 </div></td>
					<td width="15%"><div align="center"> 系统订单号<br>
						网店订单号 </div></td>
					<td width="10%"><div align="center"> 顾客姓名 </div></td>
					<td width="10%"><div align="center"> 手机 </div></td>
					<td width="10%"><div align="center"> 电话 </div></td>
					<td width="26%"><div align="center"> 地址 </div></td>
					<td width="14%"><div align="center"> 发货时间 </div></td>
				  </tr>
				  <tr>
					<td>{$orderInfo.outbound_sn}</td>
					<td> {$orderInfo.order_no}<br>
					  {$orderInfo.order_sn} </td>
					<td>{$orderInfo.user_name}</td>
					<td>{$orderInfo.mobile_phone}</td>
					<td>{$orderInfo.home_phone}</td>
					<td>{$orderInfo.address}</td>
					<td>{:date('Y-m-d H:i:s', $orderInfo['status_time'])}</td>
				  </tr>
				</tbody>
			  </table>
			  <if condition="$afterSales neq ''">
					<div id="SaleAfterRecord" style="display:;margin:10px 0px;">
						 <font class="red">提示：该出库单已有售后记录，请仔细确认，以免造成重复操作。</font>
						 <table width="100%" border="0" cellspacing="0" cellpadding="5" class="Main_List_Table" rules="none" id="tb_SaleAfter" style="display: table;margin-top: 10px; border:1px solid #ddd;">
						 	<tbody>
								<tr class="Main_List_Table_Tr1">
									<td width="10%" align="center">序号</td>
									<td width="25%" align="center">售后记录号</td>
                                    <td width="15%" align="center">售后类型</td> 
									<td width="15%" align="center">创建时间</td>    
                                    <td width="15%" align="center">状态</td>   
									<td width="20%" align="center">操作</td> 
								</tr>
								<notempty name="afterSales">
								<volist name="afterSales" id="record">
									<tr>
										<td>{$key}</td>
										<td>{$record.service_sn}</td>
										<if condition="$record.action_type eq 1"> 
										<td>退货</td>
										<elseif condition="$record.action_type eq 2"/>
										<td>换货</td>
										</if>
										<td>{:date('Y-m-d H:i:s', $record['time'])}</td>
										<td>{$record.after_sales_status}</td>
										<td><a class="btn btn-green" data-toggle="navtab" data-options="{id:'RD{$record['service_sn']}', url:'{:U('AfterSales/recordDetails?service_sn='.$record['service_sn'].'&navTabId=RD'.$record['service_sn'])}', title:'{$record.service_sn}-售后记录详情'}">查看详情</a></td>
									</tr>
								</volist>
								</notempty>
							</tbody>
						 </table>
					</div>
			  </if>
			  <div style="margin: 10px 0px;">
				<div class="margin_Bottom10"> <b>一、请选择售后类型</b><font class="red">*</font>：
				  <select name="after_sale_type" class="sel_state" data-toggle="selectpicker" data-rule="required">
					<option value="" class="sel_option">售后类型</option>
					<option value="1" class="sel_option">退货</option>
					<option value="2" class="sel_option">换货</option>
				  </select>
				</div>
				<b>二、请选择要进行售后的商品</b><font class="red">*</font>：
				<table width="100%" border="0" cellspacing="0" cellpadding="5" class="Main_List_Table" rules="none" style="margin-top: 10px; border:1px solid #ddd;">
				  <tbody>
					<tr class="Main_List_Table_Tr1">
					  <td width="15%"><div align="center"> 出库单号 </div></td>
					  <td width="24%"><div align="center"> 商品名称 </div></td>
					  <td width="13%"><div align="center"> 货号 </div></td>
					  <td width="12%"><div align="center"> 颜色/规格<br>条码 </div></td>
					  <td width="8%"><div align="center"> 购买数量 </div></td>
					  <td width="10%"><div align="center"> 零售单价 </div></td>
					  <td width="8%"><div align="center"> 售后数量 </div></td>
					  <td width="10%"><div align="center"> 退给顾客的金额 </div></td>
					</tr>
					<?php foreach($goodslist as $goods):?>
					<tr>
					  <td>{$orderInfo.outbound_sn}</td>
					  <td>{$goods.goods_name}</td>
					  <td> {$goods.goods_sn}</td>
					  <td> 颜色：{$goods.color_name}，规格：{$goods.spec_name}<br>
						{$goods.bar_code}</td>
					  <td>{$goods.goods_number}
					  <td class="lsprice"> {$goods.goods_price}
						<input type="hidden" id="goods_price_{$goods.id}" name="goods_price[]" value="{$goods.goods_price}">
						<input type="hidden"  name="order_goods_id[]" value="{$goods.id}">
					  </td>

					  <td class="lsnum"><!--<input type="text" id="lsnumtext" name="return_goods_num[]" value="{$goods.left_num}"   size="7" data-toggle="spinner" data-max="{$goods.left_num}" data-min="0" data-step="1" data-rule="integer" readonly="true">-->
                      <input type="text" id="lsnumtext" name="return_goods_num[]" value="{$goods.left_num}"   size="7"  data-max="{$goods.left_num}" data-min="0" data-step="1" >



						<font class="SaleAfterCount" color="red"><br>
						已售后：
						{$goods.after_sales_num}</font> </td>
					  <td class="tuiprice"> ￥
						<input type="text" id="return_money_{$goods.id}" name="return_money[]" size="7" value="{$goods.goods_price}" class="tuipriceinput">
                         
					  </td>
					</tr>
					<?php endforeach;?>
				  </tbody>
				</table>
          <script>
          $(function(){
			  $("#lsnumtext").blur(function(){
						var optext = $(".sel_option:selected").text();  
						if(optext == "退货") 
						{
						   
								var lsprice = $(".lsprice").text();	
								var lsnumtxt = $(this).val();	 
								$(".tuipriceinput").val(lsnumtxt*lsprice);
						 
						}	  
			  });
		 });
          </script>
                
                
			  </div>
			  <div style="margin: 10px 0px;"> <b>三、请选择责任方</b><font class="red">*</font>：
				<div style="padding-top: 10px; 
margin-left: 25px;">
				  <notempty name="dutys">
					<volist name="dutys" id="duty">
					  <input type="radio" name="duty"  data-rule="checked" data-toggle="icheck" data-label="{$duty}" value="{$duty}">
					</volist>
				  </notempty>
				</div>
				<div style="padding-top: 10px; padding-left: 20px;"> 退给顾客的运费：
				  <input name="return_shipping_fee" type="text" value="0.0" id="T_eShop_Exp_Price" style="width:50px;">
				  元</div>
			  </div>
			  <div style="margin: 10px 0px;"> <b>四、请选择售后原因</b><font class="red">*</font>：
				<div style="width:600px;margin-top: 10px;
margin-left: 25px;"> <span id="rblRemark" name="rblRemark">
				  <notempty name="afterSalesReason">
					<volist name="afterSalesReason" id="reason">
					  <input type="radio" name="reason"  data-rule="checked" data-toggle="icheck" data-label="{$reason}" value="{$reason}">
					</volist>
				  </notempty>
				  <input name="txtRemark" type="text" maxlength="150" id="txtRemark" style="width:150px;display: none;">
				  </span> </div>
			  </div>
			  <div style="margin: 10px 0px;"> <b>五、请填写售后详情</b>：
				<div style="margin-top:10px; margin-left:25px;">
					<textarea name="details" value="" cols="100" rows="10" data-toggle="autoheight"></textarea>
			   </div>
			  </div>
			  <input type="hidden" name="order_id"  value="{$orderInfo.order_id}">
			  <button type="submit" class="btn-default" style="margin-left:25px;">确定生成</button>
			</div>
			<!-- 内容结束 -->
		  </td>
		</tr>
	  </tbody>
	</table>
	</td>
	</tr>
	</tbody>
	</table>
    </form>
    <style>
    .ilabel { 
margin-right: 15px;
}
    </style>
</div>
<script language="javascript">
$(".in input[type=radio][name=reason]").on('ifChecked',function () {
	
	document.getElementById('txtRemark').style.display =  (this.value ==="其他") ? "" : "none";
	document.getElementById('txtRemark').value = "";
}).on('ifUnchecked', function () {
	document.getElementById('txtRemark').style.display =  (this.value === "其他") ? "" : "none";
	document.getElementById('txtRemark').value = "";
})
</script>


                  
